Create cairo context after running validate_visible_area()
authorKristian Rietveld <kris@gtk.org>
Wed, 15 Sep 2010 12:20:31 +0000 (14:20 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 26 Sep 2010 13:11:34 +0000 (15:11 +0200)
validate_visible_area() can change the vertical adjustment and thus
trigger window moves/scrolls.  This seems to change the surface for
which gtk_tree_view_bin_expose() just created a cairo context.  Creating
the cairo context after the call to validate_visible_area() fixes
such crashes.

gtk/gtktreeview.c

index f19b56459da94fcfa000a0beb0691335826efac0..937aaf5097895d135f9b85ed95c8a0e58347acd2 100644 (file)
@@ -4407,12 +4407,12 @@ gtk_tree_view_bin_expose (GtkWidget      *widget,
   if (event->area.height < 0)
     return TRUE;
 
+  validate_visible_area (tree_view);
+
   cr = gdk_cairo_create (event->window);
   gdk_cairo_region (cr, event->region);
   cairo_clip (cr);
 
-  validate_visible_area (tree_view);
-
   style = gtk_widget_get_style (widget);
 
   new_y = TREE_WINDOW_Y_TO_RBTREE_Y (tree_view, event->area.y);